package com.example.nio.intbuffer;

import java.nio.IntBuffer;

/**
 * @author panghu
 * @version 1.0.0
 * @createTime 2023年08月06日 11:06:00
 * @Description
 */
public class EqualsDemo {

    public static void main(String[] args) {
        IntBuffer buffer1 = IntBuffer.wrap(new int[]{1, 2, 3, 4, 5, 6, 8, 8, 9, 0}) ;
        IntBuffer buffer2 = IntBuffer.wrap(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0});
        System.out.println(buffer1.equals(buffer2));   //直接比较
        System.out.println(buffer1.compareTo(buffer2));

        buffer1.position(6);
        buffer2.position(6);
        buffer1.flip();
        buffer2.flip();
        System.out.println(buffer1.equals(buffer2));   //比较从下标6开始的剩余内容
    }

}
